'use strict'

define(['jquery', 'bootstrap', 'shiftform', 'validate', 'validate.en'], function($) {
  return {
    init: function() {
    	
      this.changePassword();
      
    },
    
    changePassword: function() {
      $(document).on("shown.bs.modal", "#change-password", function(e){
        var $passwordValidate = {'password_validate' : function(value) {
          if($("#password").val() && $("#confirmNewPassword").val()) {
            return $("#password").val() == $("#confirmNewPassword").val()
          } else {
            return true;
          }
          }
        }
        $.extend($.bt_validate.fn, $passwordValidate)
        $.extend($.bt_validate.text, {'password_validate' : '确认密码与密码不匹配!'})
        
        var $form = $(e.currentTarget).find("form");
        
        $form.bt_validate();
        
        
        /*$form.shiftform({
          beforeSubmit : function(el) {
            $('form').trigger("validate.ajax.submit");
            return $.bt_validate.result[$.bt_validate.form_id];
          }
        });*/
        
      });
      
    }
    
  }
})

